package com.bincloud.vue.admin.common.enums;

import lombok.Getter;

/**
 * @Description: 逻辑删除枚举
 * @Author: bincloud, mvpzhou
 * @Date: Create By bincloud, mvpzhou on 2022/2/16
 */
@Getter
public enum FlagEnum {
    /**
     * 逻辑删除枚举
     * 逻辑删除(0 未删除 1 已删除)
     */
    UNDELETED(0, "未删除"),
    DELETED(1, "已删除"),
    ;

    FlagEnum(int code, String msg) {
        this.code = code;
        this.msg = msg;
    }

    private final int code;
    private final String msg;

    public static boolean hasCode(int code) {
        for (FlagEnum e : FlagEnum.values()) {
           if (e.code == code) {
               return true;
           }
        }
        return false;
    }

    public static String getContentByCode(int code) {
        for (FlagEnum e : FlagEnum.values()) {
           if (e.code == code) {
               return e.msg;
           }
        }
        return "";
    }
}
